Update webhook security docs and error handling - #17
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughThis PR implements tenant-scoped role assignments by adding Changes
Sequence DiagramsequenceDiagram
actor Client
participant Service as RBACService
participant Repo as Repository<br/>(roles.go)
participant DB as PostgreSQL
Client->>Service: AssignRoleToUser(ctx, orgID, userID, roleID)
Service->>Service: Validate user exists in orgID
Service->>Service: Validate role exists in orgID
Service->>Repo: AssignRoleToUser(ctx, orgID, userID, roleID)
Repo->>DB: INSERT INTO user_roles<br/>(user_id, role_id, org_id)
alt Same-org assignment
DB-->>DB: Composite FK check:<br/>(user_id, org_id) → users<br/>(role_id, org_id) → roles
DB-->>Repo: Success
Repo-->>Service: nil
Service-->>Client: Success + Audit log
else Cross-org assignment
DB-->>DB: FK violation (code 23503)
DB-->>Repo: PgError
Repo-->>Repo: Map to ErrNotFound
Repo-->>Service: ErrNotFound
Service-->>Client: Error
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
WebhookServiceso URL validation and delivery safeguards are enforced consistently400forErrInvalidInputand document unsafe webhook URL rejection in Swagger outputTesting
Summary by CodeRabbit
Bug Fixes
Documentation
Tests